package com.cdie.myschool.mapper.TeacherTermReportMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cdie.myschool.domain.entity.AbilityTag;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

/**
 * @program:my-school
 * @ClassName:AbilityTagMapper
 * @Description:能力标签
 * @author:毛康源
 * @data:2022-10-09 20:10
 **/
@Mapper
public interface AbilityTagMapper extends BaseMapper<AbilityTag> {
    @Select("select * from ability_tag ")
    List<AbilityTag> getAbilityNo();

    @Select("select semester_id,teacher_id,timestamp from timetable where teacher_id=#{teacherId}")
    List<AbilityTag> getTimetable(String teacherId);

    @Insert("insert into ability_tag(teacher_id,semester_id,timestamp) values(#{teacherId},#{semesterId},#{timestamp}) ")
    Integer insertAbility(@Param("teacherId") String teacherId, @Param("semesterId") Integer semesterId, @Param("timestamp") Date timestamp);

    @Select("select COUNT( * ) from timetable where teacher_id=#{teacherId} and semester_id=#{semesterId}")
    Integer getCources(@Param("teacherId") String teacherId, @Param("semesterId")Integer semesterId);

    @Update("update ability_tag set ability_tag_name=#{abilityTagName} where teacher_id=#{teacherId} and semester_id=#{semesterId}")
    Integer updateAbilityTag(@Param("abilityTagName") String abilityTagName, @Param("teacherId") String teacherId, @Param("semesterId") Integer semesterId);

    @Select("select ability_tag_name from ability_tag where teacher_id=#{teacherId} and semester_id=#{semesterId}")
    AbilityTag getAbilityName(String teacherId, Integer semesterId);

    @Update("update ability_tag set ability_tag_name=#{abilityTagName} where teacher_id=#{teacherId}")
    Integer updateAbilityTag1(@Param("abilityTagName") String abilityTagName, @Param("teacherId") String teacherId);


}
